home *** CD-ROM | disk | FTP | other *** search
- JACAL uses some conventions to make conversion to other languages
- easier:
-
- Dynamic binding is not used.
-
- Multiple values are not used.
-
- No input editing is provided. Only printing characters, space, tab, and
- newline are understood by the parser.
-
- Macros are not defined.
-
- The only data types used are (), cons, integer, character, string,
- simple-vector, symbol.
-
- Backquote is not used.
-
- Only escape continuations are used.
-
- THE LEXER
-
- In stdgrm.scm there are the lines:
- (lex:def-class 70 '(#\^) #f)
- (lex:def-class 49 '(#\*) #f)
- (lex:def-class 50 '(#\/) #f)
- (lex:def-class 51 '(#\+ #\-) #f)
- (lex:def-class 20 '(#\|) #f)
- (lex:def-class 30 '(#\< #\> #\= #\: #\~) #f)
- (lex:def-class 40 '(#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9)
- (lambda (l) (string->number (list->string l))))
- (lex:def-class 41
- '(#\A #\B #\C #\D #\E #\F #\G #\H #\I #\J #\K #\L #\M
- #\N #\O #\P #\Q #\R #\S #\T #\U #\V #\W #\X #\Y #\Z
- #\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m
- #\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z
- #\@ #\_ #\% #\?)
- #f)
- (lex:def-class (lambda (chr) (or (eqv? #\" chr) (eof-object? chr)))
- '(#\")
- (lambda (l)
- (lex:read-char) (string->symbol (list->string (cdr l)))))
- (lex:def-class 0 (list slib:tab slib:form-feed #\ #\newline) #f)
-
- These lines define which character can be grouped into symbols in the
- standard input-grammar. In the first line is only the character ^ and
- its class number is not 1 removed from any other. Therefore it can
- only group with itself. Eg. ^ ^^ ^^^ ^^^^ ...
-
- e5 : a+^^^^-c;
-
- e5: ^^^^ + a - c
-
- The line (lex:def-class 30 '(#\< #\> #\= #\: #\~) #f) says that any
- consecutive combination of < > = : and ~ will be grouped together.
-
- 41 is one greater than 40 so a symbol can begin with a class 41
- character and continue with either class 41 or class 40 characters.
-
- 51 can have subsequent 50 characters; this gives us +/- and -/+.
- 50 can have subsequent 49 characters; this gives us /*.
-
- Class 0 is special (all the other numbers are arbitrary). It
- designates whitespace.
-
- #\" has a function rather than a class number. This function is #t
- when the symbol should end.
-
- The last argument to lex:def-class is the function to run on the list
- of characters of a symbol. If #f then a symbol is generated from the
- character list.
-